<!--
 * @Author: wangming
 * @Date: 2021-03-30 15:51:39
 * @LastEditors: your name
 * @LastEditTime: 2021-04-27 14:37:21
 * @Description: file content
-->
<route>
{
  "meta":{
    "title":"页面表单",
    "showMenu":true,
    "serialNum": 20
  }
}
</route>
<template>
  <div>
    <el-tabs v-model="activeTab" @tab-click="handleTabClick">
      <el-tab-pane
        v-for="(value, key) in PAGE_TYPE_ENUM"
        :key="key"
        :label="value"
        :name="key">
        <common-list v-if="activeTab === key" :type="key"/>
      </el-tab-pane>
    </el-tabs>

  </div>
</template>

<script>
import { PAGE_TYPE_ENUM } from '@/utils/enum'
import CommonList from './__components__/commonList'
export default {
  components: {
    CommonList
  },
  data () {
    return {
      activeTab: '',
      PAGE_TYPE_ENUM
    }
  },

  created () {
    const { type } = this.$route.query

    this.activeTab = type ? type.toUpperCase() : Object.keys(PAGE_TYPE_ENUM)[0]
  },

  methods: {
    handleTabClick (tab) {
      this.$router.replace({
        path: '/appModule/formPage',
        query: {
          type: tab.name.toLowerCase()
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped></style>
